/**
 * @file Compensate.h
 * @author enemy1205 (enemy1205@qq.com)
 * @brief 补偿类头文件
 * @date 2021-10-10
 */
#pragma once

#include "GyroScope.h"
#include "Tracker.h"

class Compensate {
public:
    Compensate();

    //返回XY补偿值
    inline cv::Point2f getXY_compensate() { return this->xy_compensate; }

    //获取子弹飞行时间
    inline float getTime() const { return (this->flying_time + compensateParam.WINDAGE_TIME_COMPENSATE); }

    // 调用 GetPitch 函数，完成补偿的测定
    void compensate(tracker_ptr &tracker, const GyroData_ptr &gyroData);

private:
    cv::Point2f xy_compensate; //补偿值
    float flying_time;         //飞行时间
    //根据重力模型计算y值
    float BulletModel(float, float, float);

    //获取补偿pitch角
    float GetPitch(float, float, float);
};

using Compensate_ptr = unique_ptr<Compensate>;